#include "widget.h"
#include "ui_widget.h"
#include "mlabel.h"
#include <QLabel>
#include <QLineEdit>
//#include <QPushButton>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
//    QLabel* label = new QLabel(this);//给当前对象指定一个"父对象"
//    label->setText("hallo world");
//    Mlabel* label = new Mlabel(this);//给当前对象指定一个"父对象"
//    label->setText("hallo world");
//    QLineEdit * qt = new QLineEdit(this);
//    qt->setText("qweffg");
//      QPushButton * myButton = new QPushButton(this);
//      myButton->setText("a");
      //connect(myButton,&QPushButton::clicked,this,&Widget::handls2);
      //
      connect(ui->pushButton,&QPushButton::clicked,this,&Widget::handls1);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handls1()
{
    if(ui->pushButton->text() == QString('a'))
    {
        ui->pushButton->setText("b");
    }
    else ui->pushButton->setText("a");
}

//void Widget::handls2()
//{
//    if(myButton->text() == QString('a'))
//    {
//        myButton->setText("b");
//    }
//    else myButton->setText("a");
//}
